package com.telchina.common.enums;

import cn.hutool.core.util.ArrayUtil;

/**
 * 工单状态枚举
 */
public enum WorkOrderStatusEnum {
    /**
     * 草稿（新单据）
     */
    DRAFT("0", "生成工单"),
    /**
     * 派单
     */
    DISPATCH("1", "派单"),
    /**
     * 派单回复
     */
    REPLY("11", "派单回复"),
    /**
     * 工单回单
     */
    REPLY_RECEIPT("2", "工单回单"),
    /**
     * 工单退单
     */
    REPLY_CHARGEBACK("9", "工单退单"),
    /**
     * 工单改派
     */
    REASSIGNMENT("3", "工单改派"),
    /**
     * 申请延期
     */
    EXTENSION("4", "申请延期"),
    /**
     * 结案
     */
    FINISH("5", "结案"),
    /**
     * 转派下级单位
     */
    REASSIGNMENLAST( "6", "转派下级单位"),
    /**
     * 转派回单
     */
    REASSIGNMENTLAST_RECEIPT( "7", "转派回单"),
    /**
     * 转派退单
     */
    REASSIGNMENTLAST_CHARGEBACK( "8", "转派退单"),
    /**
     * 再派单
     */
    AGAINSEND( "12", "再派单"),
    /**
     * 接单
     */
    RECEIVE( "13", "接单"),

    /**
     * 接单
     */
    MOREDISPATCH( "14", "多单位派单");


    private final String code;
    private final String info;

    public static WorkOrderStatusEnum getValueOf(String value) {
        return ArrayUtil.firstMatch(worderOrderStatus -> worderOrderStatus.getCode().equals(value), WorkOrderStatusEnum.values());
    }

    private WorkOrderStatusEnum(String code, String info) {
        this.code = code;
        this.info = info;
    }

    public String getCode() {
        return this.code;
    }

    public String getInfo() {
        return this.info;
    }
}